'''
Created on Feb 22, 2013
@Author: Rossi Kamal(rossi@khu.ac.kr)under Supervision of Professor Dr Choong Seon Hong(cshong@khu.ac.kr)
Bi_variate_gaussian_distribution_density_function
=(1/(2*pi)*(SIGMA**(1/2)))*(e**((-1/2)*(x-mu)**t(SIGMA**(-1))*(x-mu) #SIGMA-(big)-variance-covariance matrix


Notable that, x is k*2 matrix, Mean is 1*2 Matrix and SIGMA is 2*2 
'''
from math import *
import numpy.linalg as la
class BiVariateGaussianDistributionProcessorFromXMeanVarianceCovarianceMatrix:
    def __init__(self, bi_variate_mean_matrix,bi_variate_variance_covariance_matrix, bi_variate_x):
            self.bi_variate_mean_matrix=bi_variate_mean_matrix
            self.bi_variate_variance_covariance_matrix=bi_variate_variance_covariance_matrix 
            self.bi_variate_x=bi_variate_x
    def calculate_bi_variate_gaussian_distribution(self):
        bi_variate_normalizer=1/2*pi*sqrt(self.bi_variate_variance_covariance_matrix)
        bi_variate_distance_between_x_N_mean=exp(-.5*((self.bi_variate_x-self.bi_variate_mean_matrix).transpose())*(la.inv(self.bi_variate_variance_covariance_matrix))*(self.bi_variate_x-self.bi_variate_mean_matrix))
        return bi_variate_normalizer*bi_variate_distance_between_x_N_mean
        
        
        